package com.leoandroid.tool.toolsbox;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.view.View;

import androidx.appcompat.app.AppCompatActivity;

import com.leoandroid.tool.toolsbox.largeread.R;
import com.leoandroid.tool.toolsbox.largeread.databinding.ActivityAboutToolBinding;
import com.leoandroid.tool.toolsbox.largeread.utils.StatusBarUtil;
import com.leoandroid.tool.toolsbox.largeread.utils.ToolUtils;


public class AboutToolActivity extends AppCompatActivity {
    private ActivityAboutToolBinding bindingF;

    private String getVersionName(Context context) {
        PackageInfo pi = null;
        try {
            pi = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
        }
        assert pi != null;
        return pi.versionName;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        bindingF = ActivityAboutToolBinding.inflate(getLayoutInflater());
        setContentView(bindingF.getRoot());
        if (ToolUtils.getHeightStatusBar(this) > 0) {
            findViewById(R.id.include_title).setPadding(
                    0,
                    ToolUtils.getHeightStatusBar(this),
                    0,
                    0
            );
        }
        ToolUtils.setStatusBarHomeTransparent(this);
        StatusBarUtil.setLightMode(this);

        bindingF.includeTitle.backIv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        bindingF.includeTitle.titleTv.setText("关于我们");
        bindingF.versionTv.setText("V" + getVersionName(this));
    }


}